package com.lsf.dunlian.enums;

public enum MsgTypeEnum {
    /**登录*/
    LOGIN("login"),
    /**文本消息*/
    MESSAGE_TEXT("message_text"),
    /**图片消息*/
    MESSAGE_IMG("message_img"),
    MESSAGE_AUDIO("message_audio"),
    MESSAGE("message"),
    /**心跳*/
    HEARTBEAT("heartbeat");



    public static boolean isExist(String type){
        if (type.equals(LOGIN.getName())){
            return true;
        }
        if (type.equals(MESSAGE_TEXT.getName())){
            return true;
        }
        if (type.equals(HEARTBEAT.getName())){
            return true;
        }
        return false;
    }


    public static MsgTypeEnum get(String type){
        if (type.equals(LOGIN.getName())){
            return LOGIN;
        }
        if (type.equals(MESSAGE_TEXT.getName())){
            return MESSAGE_TEXT;
        }
        if (type.equals(HEARTBEAT.getName())){
            return HEARTBEAT;
        }
        throw new RuntimeException("当前类型暂不支持！");
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    private String name;


    MsgTypeEnum(String name){
        this.name=name;
    }

}
